<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTableUserVipFreeOpeCountLog extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_vip_free_ope_count_logs', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->comment('用户id');
            $table->tinyInteger('ope')->comment('记录状态');
            $table->integer('free_home_help_ope_count')->comment('作业帮操作次数');
            $table->integer('free_home_help_remain_count')->comment('作业帮剩余次数');

            $table->integer('free_resource_ope_count')->comment('面资源下载操作次数');
            $table->integer('free_resource_remain_count')->comment('免资源下载剩余次数');

            $table->integer('free_algorithm_sources_ope_count')->comment('免算法资源下载操作次数');
            $table->integer('free_algorithm_sources_remain_count')->comment('免资源下载剩余次数');

            $table->integer('resource_id')->default(0)->comment('算法或资源id');
            $table->integer('yz_payment_id')->index()->default(0)->comment('支付VIP订单id');

            $table->string('remark', '32')->comment('备注');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('user_free_home_help_logs');
    }
}
